package com.ahaoyou.utils;

import java.util.HashSet;
import java.util.Set;

/**
 * @author LH
 * @create 2022/8/17 19:11
 */
public class Constant {
    /**
     * 监听重读配置文件间隔 单位ms
     */
    public static final long LISTENER_CONFIG_INTERVAL = 10000;

    public static final String CONFIG_FILE_PROPERTIES = "application.properties";

    public static final String CONFIG_FILE_YML = "application.yml";

    public static final String JLOG_CONFIG_FILE = "jLog.properties";

    public static final String ENV = "env";

    public static final String YML = "yml";

    public static final String YAML = "yaml";

    public static final String PROPERTIES = "properties";

    public static final long DEFAULT_TIMEOUT = 2 * 1000;

    public static final long AWAIT_TIME = 3 * 1000;

    public static final String SERVER_ADDR_KEY = "serverAddr";

    public static final String NAMESPACE_KEY = "namespace";

    public static final String DEFAULT_NAMESPACE = "jLog";

    /**
     * 正则里需要特殊处理的字符串
     */
    public static final Set<String> SPECIAL_CHAR = new HashSet<String>() {
        {
            add("*");
            add(".");
            add("?");
            add("+");
            add("$");
            add("^");
            add("[");
            add("]");
            add("(");
            add(")");
            add("{");
            add("}");
            add("|");
        }
    };

    /**
     * 配置文件集合
     */
    public static final Set<String> CONFIG_FILES = new HashSet<String>() {
        {
            add(CONFIG_FILE_PROPERTIES);
            add(CONFIG_FILE_YML);
            add(JLOG_CONFIG_FILE);
        }
    };
}
